<template>
  <div>
    父组件
    <button @click="infoClick">info:{{ info }}</button>
    <button @click="btnClick">点击</button>
    <hr />
    <Son :info="info" @changeInfo="infoClick" ref="sonRef"></Son>
  </div>
</template>

<script setup>
import { ref } from "vue";
import Son from "./Son.vue";
const info = ref({
  name: "jd",
  age: 18,
  msg: {
    count: 0,
  },
});
const sonRef = ref();
const infoClick = () => {
  info.value.msg.count++;
};
const btnClick = () => {
  console.log(sonRef.value);
  sonRef.value.myClick();
};
</script>

<style scoped>
button {
  padding: 20px 20px;
  background-color: pink;
}
</style>
